﻿CREATE TABLE [dbo].[BookOrder]
(
	[Id] BIGINT IDENTITY(1,1) NOT NULL,
	[BkMemberId] BIGINT NULL,
	[WxUserId] BIGINT NULL,
	[CardNo] NVARCHAR(50) NULL,
	[CardName] NVARCHAR(50) NULL,
	[Phone] NVARCHAR(50) NULL,
	[DeptId] NVARCHAR(50) NULL,
	[DeptName] NVARCHAR(50) NULL,
	[DoctorId] NVARCHAR(50) NULL,
	[DoctorName] NVARCHAR(50) NULL, 
	[SubjectId] NVARCHAR(50) NULL,
	[RegType] NVARCHAR(50) NULL,
	[RegAmt] DECIMAL(18, 2) NULL,
	[ParentScheduleId] NVARCHAR(50) NULL,
	[ScheduleId] NVARCHAR(50) NULL,
	[BookStartTime] NVARCHAR(50) NULL,
	[BookEndTime] NVARCHAR(50) NULL,
	[RegistrarId] NVARCHAR(50) NULL,
	[MachineId] NVARCHAR(50) NULL,
	[BookStatus] INT NULL,
	[ErrorMsg] NVARCHAR(50) NULL,
	[FlowNo] NVARCHAR(50) NULL,
	[BookNo] NVARCHAR(50) NULL,
	[BookTime] NVARCHAR(50) NULL,
	[CreateTime] DATETIME NULL,
    CONSTRAINT [PK_BookOrder] PRIMARY KEY ([Id]),
)

GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BookTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'创建时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'CreateTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BookNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约流水号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'FlowNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约状态：0 - 未发起预约，1 - 预约成功，2 - 预约失败，3 - 取消预约成功，4 - 取消预约失败',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BookStatus'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约失败信息',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'ErrorMsg'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约手机号码',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'Phone'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'排班序号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'ScheduleId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'科目唯一代码',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'SubjectId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'科室唯一代码',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'DeptId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'诊疗卡号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'CardNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'医生唯一代码',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'DoctorId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'BkMember.Id',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BkMemberId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'WxUser.Id',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'WxUserId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约时段开始时间点',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BookStartTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'预约时段结束时间点',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'BookEndTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'微信端的专用ID',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'RegistrarId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'微信端的专用ID',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'MachineId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'医生名称',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'DoctorName'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'科室名称',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'DeptName'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'号类别',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'RegType'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'挂号费',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'RegAmt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'父级排班序号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'ParentScheduleId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'卡主姓名',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'BookOrder',
    @level2type = N'COLUMN',
    @level2name = N'CardName'